/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * TrainingBook
 * Copyright (C) Arnaud Duval 2010 <arnaud.duval@gmail.com>
 * 
 * Projects is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Projects is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _RICH_TRACK_POINT_HPP_
#define _RICH_TRACK_POINT_HPP_

#include <DateTime.hpp>
#include <libxml++/libxml++.h>
#include <fstream>



///@class RichTrackPoint
///@brief Defines an rich track point
class RichTrackPoint
{
    public:
        ///@brief Default constructor
        RichTrackPoint();
        ///@brief Copy constructor
        RichTrackPoint(const RichTrackPoint&);
        ///brief Destructor
        ~RichTrackPoint();
        ///@brief Overload of = operator
        RichTrackPoint& operator= (const RichTrackPoint &);
        ///@brief Read a rich track point from a XML node in a TCX file
        void ReadFromTcxFile(xmlpp::Node*);
        ///@brief Write to native XML format
        void WriteXML(std::ofstream&);
        ///Getters
        ///@brief return the date and time
        DateTime GetDateTime();
        ///@brief Return the power
        double GetPower();
        ///@brief Read from a file containing the history
        void ReadHistoryFile(xmlpp::Node*);
        
        ///@brief Overload of < operator to sort rich track points depending on their date
        friend bool operator < (const RichTrackPoint& , const RichTrackPoint &);
    private:
        ///@brief Date and Time
        DateTime time;
        ///@brief Latitude in degrees
        double latitude;
        ///@brief Longitude in degrees
        double longitude;
        ///@brief Altitude in meters
        double altitude;
        ///@brief Distance in kilometers
        double distance;
        ///@brief Heart rate in BPM
        unsigned int heartRate;
        ///@brief Cadence in RPM
        unsigned int cadence;
        ///@brief Speed in km/h
        double speed;
        ///@brief Power in W
        double power;
        ///@brief index of current intervale
        unsigned int intervaleIndex;
    
};

#endif